const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const userRoutes = require('../router')
const errorHandle = require('../app/error-handle')

const app = new Koa()

app.useRoutes = userRoutes;

// 解析body,query,params参数
app.use(bodyParser())
app.useRoutes();
// 错误统一导出
app.on('error', errorHandle)

module.exports = app